package com.lht.testDemo;

import com.alibaba.fastjson.JSONObject;

/**
 * @author Eric
 * @version 1.0
 * @date 2019-05-20
 */
public class FastJsonStringToString {

    public static void main (String[] args){
        String rst="<xml>\n" +
                "   <return_code><![CDATA[SUCCESS]]></return_code>\n" +
                "   <return_msg><![CDATA[OK]]></return_msg>\n" +
                "   <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" +
                "   <mch_id><![CDATA[10000100]]></mch_id>\n" +
                "   <nonce_str><![CDATA[IITRi8Iabbblz1Jc]]></nonce_str>\n" +
                "   <openid><![CDATA[oUpF8uMuAJO_M2pxb1Q9zNjWeS6o]]></openid>\n" +
                "   <sign><![CDATA[7921E432F65EB8ED0CE9755F0E86D72F]]></sign>\n" +
                "   <result_code><![CDATA[SUCCESS]]></result_code>\n" +
                "   <prepay_id><![CDATA[wx201411101639507cbf6ffd8b0779950874]]></prepay_id>\n" +
                "   <trade_type><![CDATA[JSAPI]]></trade_type>\n" +
                "</xml>";

        //报错，结论 fastJson 不支持转成String，xml格式先要转成Json对象，转换会失败
        String demo=JSONObject.parseObject(rst,String.class);
        System.out.println(demo);

    }
}
